//
//  YCNotificationCell.m
//  YCSchool
//
//  Created by yanglinxia on 16/4/28.
//  Copyright © 2016年 yanglinxia. All rights reserved.
//

#import "YCNotificationCell.h"

@interface YCNotificationCell ()
@property (weak, nonatomic) IBOutlet UIView *bgView;

@property (weak, nonatomic) IBOutlet UIImageView *iconImageView;

@property (weak, nonatomic) IBOutlet UILabel *notiLabel;
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;

@end

@implementation YCNotificationCell

- (void)awakeFromNib {
    // Initialization code
    
    self.bgView.layer.cornerRadius = 5;
    self.bgView.layer.masksToBounds = YES;
    
    self.iconImageView.image = [UIImage imageNamed:@"官方消息"];
    
    self.notiLabel.font = [UIFont systemFontOfSize:15];
    self.notiLabel.textColor = [UIColor blackColor];
    self.notiLabel.numberOfLines = 0;
    
    self.timeLabel.font = [UIFont systemFontOfSize:9];
    self.timeLabel.textColor = [UIColor yc_colorWithUInt:0x1a1a1a];
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setItemModel:(YCNotificationModel *)itemModel
{
    _itemModel = itemModel;
    
    self.iconImageView.image = (itemModel.type == YCNoticeTypeText)?[UIImage imageNamed:@"系统消息"]:[UIImage imageNamed:@"官方消息"];
    self.notiLabel.text = itemModel.title;
    self.timeLabel.text = [NSDate yc_dateStringWithAddTimeString:itemModel.addtime_str formatter:@"yyyy-MM-dd HH:mm:ss"];
}

@end
